package crm.model.teacherPC.net.job;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import packages.MousePackage;

public class CursorPositionJob implements Job {
	int x; 
	int y;
	public CursorPositionJob(int x, int y){
		this.x = x;
		this.y = y;
	}

	public Object doing(ObjectInputStream is, ObjectOutputStream os) {
		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		double xd = ((double)x/screenSize.width);
		double yd = ((double)y/screenSize.height);
		System.out.println("X: " + xd + " Y: " + yd);
		MousePackage mp = new MousePackage(xd, yd);
		try {
			os.writeObject(2);
			os.writeObject(mp);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

}
